package com.itheima.service.db.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.domain.SmsCouponProductCategoryRelation;
import com.itheima.mapper.SmsCouponProductCategoryRelationMapper;
import com.itheima.service.db.SmsCouponProductCategoryRelationService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class SmsCouponProductCategoryRelationServiceImpl implements SmsCouponProductCategoryRelationService {

    @Autowired
    SmsCouponProductCategoryRelationMapper smsCouponProductCategoryRelationMapper;

    @Override
    public List<SmsCouponProductCategoryRelation> findByCouponId(Long couponId) {
        LambdaQueryWrapper<SmsCouponProductCategoryRelation> qw = new LambdaQueryWrapper<>();

        qw.eq(SmsCouponProductCategoryRelation::getCouponId,couponId);

        return smsCouponProductCategoryRelationMapper.selectList(qw);
    }

    @Override
    public void save(SmsCouponProductCategoryRelation smsCouponProductCategoryRelation) {
        smsCouponProductCategoryRelationMapper.insert(smsCouponProductCategoryRelation);
    }
}
